define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'spell.group/index',
        add_url: 'spell.group/add',
        edit_url: 'spell.group/edit',
        delete_url: 'spell.group/delete',
        export_url: 'spell.group/export',
        modify_url: 'spell.group/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID',width: 10},
                    {field: 'master_name', title: '团长',width:60},
                    {field: 'goods_id', title: '商品ID',width:80 },
                    {field: 'good.good_img', title: '商品图片',templet:"#good_img"},
                    {field: 'good.good_describe', title: '商品简介'},
                    {field: 'good.good_price', title: '原价'},
                    {field: 'good.spell_group_price', title: '拼团价'},
                    {field: 'spell_group_number', title: '成团人数'},
                    {field: 'spell_group_number', title: '参与人数'},
                    {field: 'end_time', title: '结束时间'},
                    {field: 'status', search: 'select', selectList: ["关闭","开启"], title: '拼团状态',templet:ea.table.switch},
                    {field: 'active_state', search: 'select', selectList: ["关闭","开启"], title: '活动状态'},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});